// Decompiled by DJ v3.9.9.91 Copyright 2005 Atanas Neshkov  Date: 4/12/2007 10:47:28
// Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   Point2D.java

package mathematics;


// Referenced classes of package de.escape.quincunx.trafo:
//            Point3D, Vector2D

public final class Point2D
{

    public Point2D()
    {
    }

    public Point2D(Point2D p)
    {
        x = p.x;
        y = p.y;
    }

    public Point2D(Point3D p)
    {
        x = p.x;
        y = p.y;
    }

    public Point2D(float xx, float yy)
    {
        x = xx;
        y = yy;
    }

    public void scale(float f)
    {
        if(f != 1.0F)
        {
            x *= f;
            y *= f;
        }
    }

    public void add(Vector2D v)
    {
        x += v.x;
        y += v.y;
    }

    public Point2D plus(Vector2D v)
    {
        Point2D ret = new Point2D(this);
        ret.add(v);
        return ret;
    }

    public void sub(Vector2D v)
    {
        x -= v.x;
        y -= v.y;
    }

    public Point2D minus(Vector2D v)
    {
        Point2D ret = new Point2D(this);
        ret.sub(v);
        return ret;
    }

    public Vector2D minus(Point2D p)
    {
        Vector2D ret = new Vector2D(this);
        ret.sub(new Vector2D(p));
        return ret;
    }

    public boolean equals(Point2D p)
    {
        return p.x == x && p.y == y;
    }

    public String toString()
    {
        return new String((new StringBuffer()).append("[").append(x).append(",").append(y).append("]"));
    }

    public float x;
    public float y;
}